let url = {
	//登录
	login: '/api/user/login',
	//修改用户昵称，头像
	updateUserInfo: '/api/user/updateUserInfo',

	//查询我的账本
	getBookList: '/api/book/get',
	//查询对应账本列表
	getBookData: '/api/money/findList',
	//查询收支数量
	getBookDataTotal: '/api/money/total',
	//创建账本/更新账本
	saveAndUpdate: '/api/book/saveAndUpdate',
	//用户是否存在账本
	isBookMember: '/api/book/isBookMember',
	//加入账本
	userAddBook: '/api/book/userAddBook',
	//查询账本是否有编辑权限
	isBookAuthor: '/api/book/user/isBookAuthor',
	//编辑账本
	userGet: '/api/book/user/get',
	//编辑预算
	editBudget: '/api/book/user/editBudget',
	//删除账本
	deleteBook: '/api/book/delete',

	//账本分类信息
	categoryGet: '/api/category/findBookIdList',

	//记账
	saveMoney: '/api/money/save',
	//修改账单
	updateMoney: '/api/money/update',
	//删除账单
	deleteMoney: '/api/money/delete',

	//统计-总览统计
	statisticsTotal: '/api/statistics/total',
	//统计-图表统计
	chartStatistics: '/api/statistics/chartStatistics',
	//统计-获取汇总列表
	getCollectList: '/api/statistics/getCollectList',

	//查询账本当前用户信息
	bookUserinfo: '/api/book/user/get/bookUserInfo',

	//查询技巧页面信息-获取tabs列表
	listTabs: '/api/message/listTabs',
	//查询技巧页面信息-获取轮播列表
	getMainMessage: '/api/message/getMainMessage',
	//查询技巧页面信息-获取列表
	getListMessage: '/api/message/getListMessage',
	//查询技巧页面信息-获取列表详情
	getDetailMessage: '/api/message/getDetailMessage',
	//查询技巧页面信息-更新列表
	addListMessage: '/api/message/addListMessage',

	//建议接口-新增或者更新建议信息
	addAndUpdateSuggestInfo: '/api/suggestinfo/addAndUpdateSuggestInfo',
	//建议接口-查询建议信息
	selectSuggestInfo: '/api/suggestinfo/selectSuggestInfo',
	//建议接口-删除建议信息
	deleteSuggestInfo: '/api/suggestinfo/deleteSuggestInfo',

	//获取待审核的数量
	auditCount: '/api/book/user/auditCount',
	//查询所有申请加入的用户
	auditAll: '/api/book/user/auditAll',
	//查询我的申请
	myApply: '/api/book/user/my/apply',
	//同意用户加入账本
	agree: '/api/book/user/agree',
	//拒绝用户加入账本
	reject: '/api/book/user/reject',
	//用户自己退出账本
	signOutBook: '/api/book/user/signOutBook',
	//编辑成员
	edit: '/api/book/user/edit',
	//删除成员
	remove: '/api/book/user/remove',
	//添加为管理员
	addAdmin: '/api/book/user/addAdmin',
	//移除管理员
	removeAdmin: '/api/book/user/removeAdmin',
	//查询已审批记录
	selectApprovalInfo: '/api/approval/selectApprovalInfo'
}

// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	// 个人中心
	//登录
	let login = params => vm.$u.post(url.login, params)
	//修改用户昵称，头像
	let updateUserInfo = params => vm.$u.post(url.updateUserInfo, params)

	// 账本首页
	//查询账本列表
	let getBookList = (params = {}) => vm.$u.get(url.getBookList)
	//查询具体账本数据
	let getBookData = (params = {}) => vm.$u.post(url.getBookData, params)
	//统计账本数据
	let getBookDataTotal = (params = {}) => vm.$u.post(url.getBookDataTotal, params)

	// 新增账本
	let saveAndUpdate = (params = {}) => vm.$u.post(url.saveAndUpdate, params)
	//用户是否已经加入账本
	let isBookMember = (params = {}) => vm.$u.get(url.isBookMember, params)
	//用户被邀请加入账本
	let userAddBook = (params = {}) => vm.$u.get(url.userAddBook, params)

	//编辑账本是否有编辑权限
	let isBookAuthor = (params = {}) => vm.$u.get(url.isBookAuthor, params)
	// 编辑账本
	let userGet = (params = {}) => vm.$u.get(url.userGet, params)
	// 编辑预算
	let editBudget = (params = {}) => vm.$u.post(url.editBudget, params)
	//删除账本
	let deleteBook = (params = {}) => vm.$u.get(url.deleteBook, params)

	//记账分类接口
	let categoryGet = (params = {}) => vm.$u.get(url.categoryGet, params)
	//记账
	let saveMoney = (params = {}) => vm.$u.post(url.saveMoney, params)
	//修改账单
	let updateMoney = (params = {}) => vm.$u.post(url.updateMoney, params)
	//删除账单
	let deleteMoney = (params = {}) => vm.$u.get(url.deleteMoney, params)

	//统计-总览统计
	let statisticsTotal = (params = {}) => vm.$u.post(url.statisticsTotal, params)
	//统计-图表统计
	let chartStatistics = (params = {}) => vm.$u.post(url.chartStatistics, params)
	//统计-获取汇总列表
	let getCollectList = (params = {}) => vm.$u.post(url.getCollectList, params)

	//查询账本当前用户信息
	let bookUserinfo = (params = {}) => vm.$u.get(url.bookUserinfo, params)

	//查询技巧页面信息-获取tabs列表
	let listTabs = (params = {}) => vm.$u.get(url.listTabs, params)
	//查询技巧页面信息-获取轮播列表
	let getMainMessage = (params = {}) => vm.$u.get(url.getMainMessage, params)
	//查询技巧页面信息-获取列表
	let getListMessage = (params = {}) => vm.$u.post(url.getListMessage, params)
	//查询技巧页面信息-获取列表详情
	let getDetailMessage = (params = {}) => vm.$u.get(url.getDetailMessage, params)
	//查询技巧页面信息-更新列表
	let addListMessage = (params = {}) => vm.$u.post(url.addListMessage, params)

	//建议接口-新增或者更新建议信息
	let addAndUpdateSuggestInfo = (params = {}) => vm.$u.post(url.addAndUpdateSuggestInfo, params)
	//建议接口-查询建议信息
	let selectSuggestInfo = (params = {}) => vm.$u.get(url.selectSuggestInfo, params)
	//建议接口-删除建议信息
	let deleteSuggestInfo = (params = {}) => vm.$u.post(url.deleteSuggestInfo, params)

	//获取待审核的数量
	let auditCount = (params = {}) => vm.$u.get(url.auditCount, params)
	//查询所有申请加入的用户
	let auditAll = (params = {}) => vm.$u.get(url.auditAll, params)
	//查询我的申请
	let myApply = (params = {}) => vm.$u.get(url.myApply, params)
	//同意用户加入账本
	let agree = (params = {}) => vm.$u.post(url.agree, params)
	//拒绝用户加入账本
	let reject = (params = {}) => vm.$u.post(url.reject, params)
	//用户自己退出账本
	let signOutBook = (params = {}) => vm.$u.get(url.signOutBook, params)
	//编辑成员
	let edit = (params = {}) => vm.$u.get(url.edit, params)
	//删除成员
	let remove = (params = {}) => vm.$u.get(url.remove, params)
	//添加成员为管理员
	let addAdmin = (params = {}) => vm.$u.get(url.addAdmin, params)
	//移除管理员
	let removeAdmin = (params = {}) => vm.$u.get(url.removeAdmin, params)
	//查询已审批记录
	let selectApprovalInfo = (params = {}) => vm.$u.post(url.selectApprovalInfo, params)


	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {
		login,
		updateUserInfo,
		getBookList,
		getBookData,
		getBookDataTotal,
		saveAndUpdate,
		isBookMember,
		userAddBook,
		isBookAuthor,
		userGet,
		editBudget,
		deleteBook,
		categoryGet,
		saveMoney,
		updateMoney,
		deleteMoney,
		statisticsTotal,
		chartStatistics,
		getCollectList,
		bookUserinfo,
		listTabs,
		getMainMessage,
		getListMessage,
		getDetailMessage,
		addListMessage,
		addAndUpdateSuggestInfo,
		selectSuggestInfo,
		deleteSuggestInfo,
		auditCount,
		auditAll,
		myApply,
		agree,
		reject,
		signOutBook,
		edit,
		remove,
		addAdmin,
		removeAdmin,
		selectApprovalInfo
	}
}

export default {
	install
}